package com.glory.dmegcpda.model

import com.glory.dmegcpda.base.Constant
import com.glory.dmegcpda.bean.ScriBingCaseBean
import com.glory.dmegcpda.bean.ScrinBingBoxBean
import com.glory.dmegcpda.bean.ScrinBingEqpBean
import com.google.gson.JsonObject
import rxhttp.wrapper.param.RxHttp
import rxhttp.wrapper.param.toResponse


class ScribingRepository : BaseRepository(){
    /**
     * 获取物料信息
     * */
    suspend fun scribingCase(bodyMap: JsonObject): ScriBingCaseBean {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonData(bodyMap,"SYS.GETENTITYLIST"))
            .toResponse<ScriBingCaseBean>()
            .await()
    }
    /**
     * 获取设备信息
     * */
    suspend fun scribingEqp(bodyMap: JsonObject): ScrinBingEqpBean {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonData(bodyMap,"SYS.GETENTITYLIST"))
            .toResponse<ScrinBingEqpBean>()
            .await()
    }

    /**
     * 获取盒子信息
     * */
    suspend fun scribingBox(bodyMap: JsonObject): ScrinBingBoxBean {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonData(bodyMap,"SYS.GETENTITYLIST"))
            .toResponse<ScrinBingBoxBean>()
            .await()
    }

    /**
     * 划片上料
     * */
    suspend fun scribing(bodyMap: JsonObject): Any {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonData(bodyMap,"DMEGC.PDAMLOTCUTTING"))
            .toResponse<Any>()
            .await()
    }

}